﻿@{
    ViewBag.Title = "Project Management Web - Pagina de Administración";
}

<p align="right">
@Html.ActionLink("<< Regresar", "Index", "Admin")
</p>


<fieldset>

    <legend>Bienvenido</legend>
    <h1>@User.Identity.Name</h1>

    @{
        
    projectManagementWeb.Controllers.DeveloperController controlLayer = new projectManagementWeb.Controllers.DeveloperController();
    projectManagementWeb.Models.Developer.UserDataModel userData = controlLayer.GetUserData(@User.Identity.Name);

    string RolesDescription = string.Empty;
    
    <h2>@userData.UserCompleteName</h2>
    <h2>@userData.UserMail</h2>
    
   }


   @using (Html.BeginForm())
   { 
       @Html.ValidationSummary(true)
        <legend>Lista de Usuarios</legend>
           using (Html.BeginForm())
    {
    <input type="submit" value="OK" style="visibility:hidden" />
    }
       <table>
       <tr>
       <td></td>
       <td colspan="6" align="right">@Html.ActionLink("Crear Usuario", "Register", "Account")</td>
       </tr>
       <tr>
       <td></td>
       <td></td>
       <td>Usuario</td>
       <td>Email</td>
       @*<td>En Linea</td>*@
       <td>Fecha de Creación</td>
       <td>Fecha de Ultimo Acceso</td>
       <td>Rol</td>
       </tr>
       @foreach (MembershipUser user in Model)
       {
           
           <tr>
               <td>
               @using (Html.BeginForm("EditUser", "Admin", FormMethod.Post))
               {             
                    <input type="hidden" name="userName" value="@(user.UserName)"/>
                    <input type="submit" value="Editar"/>
               }
               @*@Html.ActionLink("Editar", "EditUser", "Admin")*@
               </td>
               <td>
               @using (Html.BeginForm("DeleteUser", "Admin", FormMethod.Post))
               {             
                    <input type="hidden" name="userName" value="@(user.UserName)"/>
                    <input type="submit" value="Borrar"/>
               }
               @*@Html.ActionLink("Borrar", "DeleteUser", "Admin")*@
               </td>
               <td>@user.UserName
               </td>
               <td>@user.Email
               </td>
               @*<td>@user.IsOnline
               </td>*@
               <td>@user.CreationDate
               </td>
               <td>@user.LastLoginDate
               </td>
               <td>@{ RolesDescription = string.Empty;
                      foreach (string name in Roles.GetRolesForUser(user.UserName))
                      {
                          RolesDescription = name.ToString() + "," + RolesDescription;
                      }
           
       }@RolesDescription
               </td>
@*               <td>@user.ProviderName
               </td>*@
           </tr>
@*       <li>@user.UserName</li>*@

       }
           <tr>
               <td>
               </td>
               <td colspan="6" align="right">@Html.ActionLink("Crear Usuario", "Register", "Account")</td>
           </tr>
       </table>
       
        <ul>

</ul>

   }



</fieldset>
